package com.an;

public class Extend {
    public static void main(String[] args) {

        Son son = new Son("小明",16,99);
        son.info();
        Father father=new Son("小王",19,88);
        father.info();
        father.setAge(70);
       Son fs=(Son)father;
       fs.setScore(777);

        son.setScore(100);
        son.setName("蔡徐坤");
        son.info();
        father.info();
        System.out.println("===================");
        System.out.println("fs="+fs);
        System.out.println("father="+father);

    }
}

class Father{
    private String name;
    private int age;

    public void info(){
        System.out.println("我是"+name+"今年"+age);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Father(String name, int age) {
        this.name = name;
        this.age = age;
    }
}

class Son extends Father{
 private double score;


    public void info(){
     super.info();
        System.out.println("我考试考了"+score);
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

    public Son(String name, int age, double score) {
        super(name, age);
        this.score = score;
    }
}